<template>
  <section>
    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item class="mb-10">
          <el-input size="small" v-model="filters.name" placeholder=""></el-input>
        </el-form-item>
        <el-form-item class="mb-10">
          <el-button size="small" type="danger" v-on:click="getWarnings">搜索</el-button>
        </el-form-item>

      </el-form>
    </el-col>

    <el-table :data="WarningData" highlight-current-row v-loading="listLoading"
      style="width: 100%;">
      <el-table-column type="selection" width="55">
      </el-table-column>
      <el-table-column type="index" label='序号' min-width="60">
      </el-table-column>
      <el-table-column prop="deviceName" label="设备名称" min-width="120" sortable>
      </el-table-column>
      <el-table-column prop="max" label="上限阈值" min-width="120" sortable>
      </el-table-column>
      <el-table-column prop="min" label="下限阈值" min-width="120" sortable>
      </el-table-column>
      <el-table-column prop="record" label="参数值" min-width="100" sortable>
      </el-table-column>
      <el-table-column prop="startTime" label="开始时间" min-width="100" sortable>
      </el-table-column>
      <el-table-column prop="endTime" label="结束时间" min-width="100" sortable>
      </el-table-column>
      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <div class="block">
      <el-pagination style="text-align: right;" background layout="total,prev, pager, next"
        :current-page="pageNo" @current-change="handleCurrentChange" :page-size="pageSize" :total="total"></el-pagination>
    </div>


  </section>

</template>
<script>
  export default {
    name: 'test6',
    //组件创建
    created() {},
    mounted() {
      this.getWarnings();
    },
    data() {
      return {
        filters: {
          name: ''
        },
        WarningData: [],
        total: 0,
        page: 1,
        listLoading: false,
        pageNo: 1,
        pageSize: 10,


      }
    },
    methods: {

      //获取网关列表
      getWarnings() {
        var params = {
          pageNo: this.pageNo,
          pageSize: this.pageSize,
        }
        this.api.get('/work/awbWarning/list', {params: params}).then((res) => {
          this.WarningData = res.data.result.records;
          this.total = res.data.result.total
        });
      },
      handleCurrentChange(val) {
        this.pageNo = val;
        this.getWarnings();
      },
      //删除
      handleDel: function(index, row) {
        this.$confirm('确认删除该记录吗?', '提示', {
          type: 'warning'
        }).then(() => {
          this.listLoading = true;
          var params = {

            id: row.id
          }
          deleteNetApi(params).then((res) => {
            this.listLoading = false;
            this.getNets();
          });
        }).catch(() => {

        });
      },



    }
  }
</script>
<style lang="less" scoped>
</style>
